//go:build ignore
// +build ignore

package main

import (
	"database/sql"
	"fmt"
)

func TestQuerySyntax(db *sql.DB) {
	// 测试1: 基本的 Query(`...`) 语法
	query1 := Query(`
		SELECT * FROM users WHERE active = 1
	`)
	fmt.Println("Query 1:", query1.String())

	// 测试2: 参数化查询
	userID := 123
	status := "active"
	query2 := Query(`
		SELECT * FROM users WHERE id = #{userID} AND status = #{status}
	`)
	fmt.Println("Query 2:", query2.String())

	// 测试3: 文本插入
	tableName := "users"
	query3 := Query(`
		SELECT * FROM {tableName} WHERE active = #{true}
	`)
	fmt.Println("Query 3:", query3.String())

	// 测试4: 嵌套SQL块（使用单引号）
	query4 := Query(`
		SELECT * FROM users WHERE id IN (
			{
				return Query('
					SELECT user_id FROM permissions WHERE role = #{"admin"}
				')
			}
		)
	`)
	fmt.Println("Query 4:", query4.String())

	// 测试5: 复杂条件逻辑
	includeInactive := false
	query5 := Query(`
		SELECT * FROM users WHERE {
			if includeInactive {
				return "1=1"
			} else {
				return "active = 1"
			}
		}
	`)
	fmt.Println("Query 5:", query5.String())
}

func main() {
	fmt.Println("测试新的 Query() 语法")
	TestQuerySyntax(nil)
}
